import 'package:distribution_mall_flutter/constant/cf_constant.dart';
import 'package:distribution_mall_flutter/provider/goods/product_details.dart';
import 'package:distribution_mall_flutter/utils/image_loader.dart';
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class ProductBrand extends ConsumerWidget {
  const ProductBrand({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final modal = ref.watch(pDetailProvider);
    return SliverToBoxAdapter(
      child: Visibility(
          visible: modal.detail?.suInfo?.brandLogo?.isNotEmpty == true,
          child: Container(
            padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
            margin: const EdgeInsets.only(
                top: 26, left: 16, right: 16),
            decoration: BoxDecoration(
              color: const Color.fromRGBO(249, 251, 253, 1),
              borderRadius: BorderRadius.circular(14.6),
            ),
            child: Row(
              children: [
                Visibility(
                    visible: modal.detail?.suInfo?.brandLogo != null,
                    child: ExtendedImage.network(
                        modal.detail?.suInfo?.brandLogo ?? '',
                        width: 40,
                        fit: BoxFit.cover,
                        enableLoadState: false,
                        height: 40,
                        shape: BoxShape.circle,
                        border: Border.all(
                          color: const Color(0xFFE4E4E4),
                          width: 0.5,
                        ))),
                const SizedBox(
                  width: 8,
                ),
                Expanded(
                    child: Text(
                  modal.detail?.suInfo?.brandName ?? '',
                  style: const TextStyle(
                      fontSize: 14.6,
                      fontWeight: FontWeight.w600,
                      color: Color.fromRGBO(29, 29, 29, 1),
                      letterSpacing: TextConstant.letterSpacing),
                ))
              ],
            ),
          )),
    );
  }
}
